/**
 * Created by cc
 * Description:
 * User: CZH
 * Date: 2022-09-26
 * Time: 20:16
 */

class UserName1Error extends Exception{
    public UserName1Error(String message) {
        super(message);
    }
}
class PassWord1Error extends Exception{
    public PassWord1Error(String message) {
        super(message);
    }
}

public class Test04 {
    private static String userName = "admin";
    private static String passWord = "123456";

    public static void main(String[] args) throws UserName1Error, PassWord1Error {
        login("admn","2345");
    }

    public static void login(String name, String word) throws UserName1Error, PassWord1Error {
        if (!Test04.userName.equals(name)) {
            throw new UserName1Error("用户名");
        }
        if (!Test04.passWord.equals(word)) {
            throw new PassWord1Error("密码");
        }
        System.out.println("登录成功");
    }
}
